package io.renren.modules.exam.tiMuManage.controller;
import io.renren.modules.exam.tiMuManage.entity.ChuanDiEntity;
import io.renren.modules.exam.tiMuManage.entity.TiMuEntity;
import io.renren.modules.exam.tiMuManage.service.TiMuService;
import io.renren.modules.sys.controller.AbstractController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/exam/TiMuManage")
@Api("题库管理")
public class TiMuController {
    @Autowired
    private TiMuService tiMuService;
    //根据题号进行查询
    @GetMapping("/QueryById")
    @ApiOperation("单条件查询")
    public TiMuEntity TiMuQuery(Integer q_id)throws IOException {


      System.out.println("000000000000000000000000000000测试1"+q_id);

        TiMuEntity tiMuEntity=tiMuService.queryByQuestion(q_id);
        System.out.println("000000000000000000000000000000测试2"+tiMuService.queryByQuestion(q_id));
        return tiMuService.queryByQuestion(q_id);
    }



    //菜单，多个条件查询
    @GetMapping("/QueryMany")
    @ApiOperation("多条件查询")
    public List<TiMuEntity> TiMuQuery2(HttpServletRequest request,String q_typeDescribe,String q_typeFenlei )throws IOException {
          List<TiMuEntity> tiMuEntities = tiMuService.queryByQuestionMany(q_typeDescribe,q_typeFenlei);
          return tiMuEntities;
    }



    //添加题目
    public int insertTimuList(String q_typeDescribe,int q_typeId,String ans_id,String q_score,String ans_id1,String ans_id2,String ans_id3,String ans_id4){
        int retur=tiMuService.insertTimu(q_typeDescribe,q_typeId,ans_id,q_score,ans_id1,ans_id2,ans_id3,ans_id4);

        return retur;
    }
}
